<?xml version="1.0" encoding="utf-8"?>
<taskrunner name="upgrade.sqlserver" version="1.0" date="2012-03-07" maxthreads="1">

	<!--      
      Created for: CR3904: 2012-03-07: teriks28
        Upgrade SQL Express 2005 to SQL Express 2008 R2
  -->

	<includes>
		<file name="vida.install.settings.xml" />
	</includes>

	<tasks>
		
		<task name="start.sqlexpress.service" condition="¤{sqlserver.installed}=true" typename="@WindowsServiceCommand">
			<description>
				Starts SQL xpress instance.
			</description>
			<dependencies list=""/>
			<parameters>
				<parameter name="server.name" value=""/>
				<parameter name="service.name" value="MSSQL$${sqlserver.instance.name}"/>
				<parameter name="command" value="start"/>
				<parameter name="throwException" value="false"/>
			</parameters>
		</task>

		<task name="get.installed.sql.version" assembly="${a1}" condition="¤{sqlserver.installed}=true" typename="vida.install.utilities.GetInstalledSQLVersion">
			<description>
				Returns version of installed SQL Express.
			</description>
			<dependencies list="start.sqlexpress.service"/>
			<parameters>
				<parameter name="connectionstring" value="${master.cs}"/>
				<parameter name="sql" value="SELECT SERVERPROPERTY('productversion')"/>
				<parameter name="output.variable" value="installed.sql.version"/>
			</parameters>
		</task>
		
		<task name="upgrade" critical="true" condition="¤{sqlserver.installed}=true AND ¤{installed.sql.version}=${version.sqlserver2005}">
			<description>
				Upgrade SQL Express 2005 to Sql Server 2008 R2 Express
			</description>
			<errormessage>
				An error occurred while upgrading Microsoft Sql Server Express 2005 to 2008 R2 Express.
			</errormessage>
			<dependencies list="get.installed.sql.version"/>
			<subtasks filename="vida.reinstall.sqlserver.xml"/>
		</task>
				
		<task name="uninstall" condition="¤{sqlserver.installed}=true AND ¤{installed.sql.version}=${version.sqlserver2005} AND ¤{sqlexpress.reinstall.exitcode}=0">
			<description>
				Unistall SQL Express 2005
			</description>
			<errormessage>
				An error occurred while uninstalling Microsoft SQL Server Express 2005.
			</errormessage>
			<dependencies list="upgrade"/>
			<subtasks filename="vida.uninstall.SQLServer2005.xml"/>
		</task>		
		
	</tasks>
</taskrunner>
